handle: use per-request sockets for VF-only configuration - #1209
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesHandle construction
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I simply don't understand this PR and I'm afraid that because of its convoluted AI generated description that it would make the situation worse by complicating the current API hidden state and behavior even more. |
|
@thediveo updated PR description, hope it's easier to understand now |
| // specified, the returned Handle creates a socket for each request in the | ||
| // caller's current network namespace instead of keeping persistent sockets. | ||
| func NewHandleWithOptions(opts HandleOptions, nlFamilies ...int) (*Handle, error) { | ||
| if opts.DisableVFInfoCollection && !opts.RetryInterrupted && opts.NetNS == nil && len(nlFamilies) == 0 { |
There was a problem hiding this comment.
I don't know how widely is NewHandleWithOptions() used now, so just want to open a small window to allow disabling VFInfoCollection without init Handle.sockets.
PR vishvananda#1174 changed ConfigureHandle() to configure the package-wide pkgHandle through NewHandleWithOptions(), which creates persistent netlink sockets in the pkgHandle. Because pkgHandle.sockets remains bound to the network namespace where it was created, the following operations could target the wrong namespace after the calling OS thread changed namespaces. This PR returns a handle without nil sockets when the caller only disables VF information collection: NewHandleWithOptions(HandleOptions{ DisableVFInfoCollection: true, }) Signed-off-by: Lei Huang <leihuang.dev8@gmail.com>
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@vishvananda @aboch could you please take a look? Thanks. |
description
PR #1174 changed ConfigureHandle to configure the package-wide
pkgHandlethrough NewHandleWithOptions, which creates persistent netlink sockets in thepkgHandle.Because
pkgHandle.socketsremains bound to the network namespace where it was created, the following operations could target the wrong namespace after the calling OS thread changed namespaces.This PR returns a handle without nil
socketswhen the caller only disables VF information collection:Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Tests